
from collections import Counter

class Solution:

    def minWindow(self, s, t):

        m = len(s)

        if m < len(t):
            return ""

        ansL, ansR = -1, m
        cnt_t = Counter(t)
        cnt_s = Counter()

        letf = 0
        for right, c in enumerate(s):

            while cnt_s >= cnt_t:
                if right - letf < ansR - ansL:
                    ansR, ansL = right, letf

                cnt_s[s[letf]] -= 1
                letf += 1
            cnt_s[c] += 1
        
        if ansL < 0:
            return ""
        else:
            return s[ansL: ansR + 1]


